home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / sco / scripts / settabs < prev    next >
Encoding:
AWK Script  |  1997-08-26  |  1.2 KB  |  48 lines

  1. #!/usr/local/bin/gawk -f
  2. #!/usr/bin/awk -f
  3. # @(#) settabs.gawk 1.0 94/03/09
  4. # 93/09/27 john h. dubois iii (john@armory.com)
  5. # 93/10/30 Only set current screen unless an arg is given
  6. # 93/12/22 Added help, options, and tty args.
  7. # 94/03/09 Use gawk so - options can be given
  8.  
  9. BEGIN {
  10.     # Turn on iBCS2 capabilities and clear all tabs
  11.     # Make sure we are at column 0
  12.     Reset = "\033[=3L\033[3g\015"
  13.     for (tabstop = 0; tabstop <= 9; tabstop++)
  14.     Reset = Reset "        \033H"
  15.  
  16.     if (ARGC < 2)
  17.     print Reset
  18.     else {
  19.     if (ARGV[1] ~ /^[-+]h$/) {
  20.         Name = "settabs"
  21.         print \
  22. Name ": reset tab stops on console screens.\n"\
  23. "Usage: " Name " [-ah] [ttynn ...]\n"\
  24. "A reset string is emitted to set the tabs\n"\
  25. "on the named ttys to every 8 columns.\n"\
  26. "If no ttys are named, the string is emitted\n"\
  27. "to the current screen.\n"\
  28. "Options:\n"\
  29. "-h: print this help.\n"\
  30. "-a: set tabs all console screens."
  31.         exit(0)
  32.     }
  33.     else if (ARGV[1] ~ /^[-+]a$/)
  34.         for (screen = 1; screen <= 12; screen++) {
  35.         screen = sprintf("/dev/tty%02d",screen)
  36.         print Reset > screen
  37.         close(screen)
  38.         }
  39.     else {
  40.         for (i = 1; i in ARGV; i++) {
  41.         screen = "/dev/" ARGV[i]
  42.         print Reset > screen
  43.         close(screen)
  44.         }
  45.     }
  46.     }
  47. }
  48.